import { _decorator, Component, Node, tween, v3 } from 'cc';
const { ccclass, property } = _decorator;

@ccclass('CommAnim')
export class CommAnim {
    

    public static zoomNode(target: Node,duration: number,rate: number){
        let scale1 = v3(rate,rate,0.1)
        let scale2 = v3(-rate,-rate,0.1)
        return tween(target)
            .by(duration,{scale:scale1})
            .by(duration,{scale:scale2})
            // .by(duration,{scale:scale1})
            // .by(duration,{scale:scale2})
            .start()
        
    }

    public static getRandomIntInRange(min: number, max: number): number {
        // 确保最小值小于或等于最大值
        if (min > max) {
            throw new Error('最小值不能大于最大值');
        }
    
        // 生成范围内的随机整数
        return Math.floor(Math.random() * (max - min + 1)) + min;
    }
}


